<%-- 
    Document   : newfeed
    Created on : Jun 6, 2013, 8:12:18 PM
    Author     : Hoang
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@taglib uri="/struts-tags" prefix="s"%>

<c:if test="${empty USER}">
    <jsp:forward page="login.html"/>
</c:if>

<jsp:include page="header.jsp"/>
<a id="totop" class="bgcolor" title="back to top" href="#top-page">
    <img title="" alt="top" src="img/backtop.gif"/> Về đầu trang
</a>
<div id="content">
    <div class="container san-serif-font">
        <c:if test="${empty request.outputXML}">

            <h3>Nhập địa chỉ RSS để thêm feed mới</h3>
            <form action="insertFeed.action" method="post">
                <table>
                    <tr>
                        <td>Địa chỉ RSS(<font color="red">*</font>)</td>
                        <td width="600px"><input class="input" type="text" name="rssLink" id="rssLink" size="80" /></td>
                    </tr>
                    <tr>
                        <td>Tên feed</td>
                        <td width="600px"><input class="input disabled" type="text" name="rssName" id="rssName" value="" readonly="readonly" size="80"/></td>
                    </tr>
                    <tr>
                        <td>Thông tin</td>
                        <td> <textarea class="input disabled" name="rssDescription" id="rssDescription" rows="2" cols="60" readonly="readonly">
                            </textarea> </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td id="infoDiv"></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td style="text-align: right">
                            <input type="button" value="Check Feed" id="btnCheck" name="btnCheck" />
                            <input type="submit" value="Thêm Feed" id="btnAdd" name="btnAdd" disabled="disabled" />
                        </td>
                    </tr>
                </table>
            </form>

            <script src="js/ajaxAddFeed.js" type="text/javascript"></script>

        </c:if>

        <c:if test="${not empty request.outputXML}">
            <div style="text-align: center">
                <ul id="feed-info-list" class="clearfix">
                    <li>
                        <div class="rss-entry">
                            <dl class="horizon-dl">
                                <dt>Tên feed</dt>
                                <dd><s:property value="rssName"/></dd>
                                <dt>Địa chỉ RSS</dt>
                                <dd><s:property value="rssLink"/></dd>
                                <dt>Thông tin</dt>
                                <dd><s:property value="rssDescription"/></dd>
                            </dl>
                            <div class="text-right">
                                <form action="addFeedToUserList.action" method="post">
                                    <input type="hidden" name="rssID" value="${newID}" />
                                    <input type="hidden" name="returnTo" value="index" />
                                    <input type="submit" class="button" value="Thêm feed" />
                                    <a class="button" href="index.action">Quay lại trang chủ</a>
                                </form>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>

            <c:import charEncoding="UTF-8" url="${request.outputXML}" var="xmldoc"/>
            <c:import charEncoding="UTF-8" url="WEB-INF/xsl/rssSecondPass.xsl" var="xsldoc"/>
            <x:transform xml="${xmldoc}" xslt="${xsldoc}"/>

        </c:if>

    </div>
</div>
<div class="clearfix"></div>
<jsp:include page="footer.jsp"/>